import pandas as pd

# Read the Excel file
df = pd.read_excel('origin_doi.xlsx')

# Check if 'DOI' column exists
if 'DOI' in df.columns:
    # Extract all DOI values
    doi_values = df['DOI'].tolist()
    
    # Print all DOI values
    print("DOI values:")
    for doi in doi_values:
        print(doi)
    
    # Optional: Save to a text file
    with open('doi_values.txt', 'w') as f:
        for doi in doi_values:
            if pd.notna(doi):  # Check for NaN values
                f.write(f"{doi}\n")
    
    print(f"\nTotal DOIs extracted: {len([d for d in doi_values if pd.notna(d)])}")
    print("DOI values have been saved to 'doi_values.txt'")
else:
    # If the column has a different name, try to find it
    columns = df.columns
    print(f"'DOI' column not found. Available columns: {list(columns)}")
